package com.blocks.mq.producer.reader.impl;

import com.alibaba.fastjson.JSON;
import com.blocks.mq.producer.reader.Reader;
import com.blocks.mq.producer.repository.StudentRepository;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.IOException;
@Service
@Configuration
public class DatebaseReader implements Reader {
    @Resource
    StudentRepository studentRepository;


    @Override
    public String reader(String id) throws IOException {
        //
        return JSON.toJSONString(studentRepository.findById(Integer.valueOf(id)));
    }
}
